<html>
<head>
    <meta charset="UTF-8">
    <title>UI风格切换</title>
    <link href="static/easyui/themes/bootstrap/easyui.css" rel="stylesheet" type="text/css"/>
    <link href="static/easyui/themes/icon.css" rel="stylesheet" type="text/css"/>
    <link href="static/css/esaas-easyui-add.css" rel="stylesheet" type="text/css"/>
    <script src="static/easyui/jquery.min.js" type="text/javascript"></script>
    <script src="static/easyui/jquery.easyui.min.js" type="text/javascript" charset="utf-8"></script>
    <script src="static/easyui/locale/easyui-lang-zh_CN.js" type="text/javascript"></script>
    <script src="static/plugin/assets/jslib.util.js" type="text/javascript"></script>
    <script src="static/plugin/assets/jslib.jquery.ajax.js" type="text/javascript"></script>
    <script src="static/plugin/assets/jslib.easyui.util.js" type="text/javascript"></script>
    <script src="static/js/libs/jquery.cookie.min.js" type="text/javascript"></script>
    <script src="ffres/dict/all.js" type="text/javascript"></script>
    <a href="" target="_blank" id="commonLink" name="commonLink"></a>
</head>
<body class="easyui-layout">
<form id="ff" method="post">
    <div class="esaas-info-title">UI风格切换</div>
    <table class="esaas-info-add-table">
        <tr>
            <td width="45%" align="right">UI风格：</td>
            <td width="50%" align="left">
                <select class="easyui-combobox" name="theme" id="theme" labelPosition="top" style="width:100px;">
                    <option value="easyui">easyui</option>
                    <option value="bootstrap">bootstrap</option>
                    <option value="react">react</option>
                </select>
            </td>
        </tr>

    </table>
</form>
<div style="text-align: center; padding-top: 15px">
    <a href="javascript:void(0)" class="easyui-linkbutton"
       onclick="submitForm()">&nbsp;切&nbsp;换&nbsp;</a>
</div>
<script>
    $(function() {
        var theme = $.cookie('theme') || 'easyui';
        $('#theme').combobox('setValue', theme);
    });

    function submitForm() {
        if (!$('#ff').form('validate'))
            return;

        var theme = $('#theme').combobox('getValue');
        $.cookie('theme', theme);
        // 切换风格
        var themepath = 'page';
        if (theme == 'bootstrap') {
            themepath = 'vue';
        } else if (theme == 'react') {
            themepath = 'react'
        } else {
            // 默认是easyui
            themepath = 'page';
        }
        window.parent.location.href = `${themepath}/index.html`;
    };

    function closeForm() {
        window.parent.JLEUtil.closewin();
    }
</script>
</body>
</html>